<?php

//服务器和数据库信息
$servername = "localhost";
$username = "root";
$password = "";

//创建连接
$conn = new mysqli($servername,$username,$password);

//检查连接状态
if ($conn->connect_error) {
  # code...
  die('fail to connect' . $conn->connect_error);
}

$dbName = 'myDB';
$sql = "CREATE DATABASE $dbName";
if ($conn->query($sql) === true) {
  echo($dbName . "Create success");
}
else{
  echo("fail to create $dbName " . $conn->error);
}

$conn->close();
?>